package lipengfei.botaiframework.security.jwt.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

import lipengfei.botaiframework.jwt.JwtProperties;
import lombok.Data;

@ConfigurationProperties("botai.security.jwt.token")
@Data
public class JwtTokenProperties {

    public  static String headerName = "accessToken";

    /**
	 * 有效期10分钟
	 * */
    public static  Long expire = 60L*10;


    public  static  String secret = "123456";
	

    public  static  String issuer = "server";
    

    public  static String subject = "spring.security.jwt";
    

    public  static  String audience = "client";

    
	public  void setHeaderName(String headerName) {
		JwtTokenProperties.headerName = headerName;
	}


	public static void setExpire(Long expire) {
		JwtTokenProperties.expire = expire;
	}

	public  void setSecret(String secret) {
		JwtTokenProperties.secret = secret;
	}

	public  void setIssuer(String issuer) {
		JwtTokenProperties.issuer = issuer;
	}

	public  void setSubject(String subject) {
		JwtTokenProperties.subject = subject;
	}

	public static void setAudience(String audience) {
		JwtTokenProperties.audience = audience;
	}
    
    
    
	public static JwtProperties   buildJwtProperties() {
		JwtProperties jwtProperties = new JwtProperties();
		jwtProperties.setAudience(audience);
		jwtProperties.setExpire(expire);
		jwtProperties.setIssuer(issuer);
		jwtProperties.setSecret(secret);
		jwtProperties.setSubject(subject);
		return jwtProperties;
	} 
 
    
}
